package com.smz.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.smz.dao.MenuDAO;
import com.smz.entity.Menu;
import com.smz.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class MenuServiceImpl extends ServiceImpl<MenuDAO, Menu> implements MenuService {

    @Autowired
    MenuDAO menuDAO;

    @Override
    public List<Menu> findAllMenuByUsername(String username) {
        return menuDAO.selectAllMenuByUsername(username);
    }

    @Override
    public List<Menu> listWithTree() {

        return menuDAO.listWithTree();
    }

    @Override
    public void addMenu( Menu menu) {
        menuDAO.insert(menu);
    }

    @Override
    public void modifyMenu(Menu menu) {
        menuDAO.updateById(menu);
    }

    @Override
    public void deleteMenuById(Integer id) {
        menuDAO.deleteById(id);
    }

    @Override
    public void deleteMenuByIdAndPid(Integer id) {
        menuDAO.deleteMenuByIdAndPid(id);
    }


}
